package com.example.service.webhook.business.carrier.repository;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.example.service.webhook.business.carrier.entity.MobileVoiceCallEntity;
import com.example.service.webhook.repository.base.BaseDAO;
/**
 * 运营商套餐适用情况
 * ClassName: PackageUsageRepository
 * date: 2016年7月19日 下午6:29:23   
 * @author yuandong  
 * @version   
 * @since JDK 1.6
 */
@Repository
public class MobileVoiceRepairRepository extends BaseDAO<MobileVoiceCallEntity>{
	
	@Resource(name="templateCarrier")
    private JdbcTemplate jdbcTemplate;

    public JdbcTemplate getJdbcTemplate() {
		return jdbcTemplate;
	}
    
    
    public Integer countMobileVoice(){
            String sql = "select max(id) from  t_voicecall";
            try{
            	Integer maxId = getJdbcTemplate().queryForObject(sql, Integer.class);
            	return maxId;
            }catch(EmptyResultDataAccessException e){
            	return 0;
            }
            
    }
    
    
    public List<MobileVoiceCallEntity> queryList(int minid,int maxid){
    	String sql = "select * from  t_voicecall where id>? and id<=?";
        try{
        	List<MobileVoiceCallEntity> list = this.query(sql, new Object[]{minid,maxid}, new MobileVoiceCallEntity());
        	return list;
        }catch(Exception e){
        	return null;
        }
    }
    
    
}
